
    version(fgh_win32dll)
    {

INITCODE0	MACRO
	HOST_ESP = ESP;
		ENDM


INITCODE1	MACRO
	// nt chicago initialization

	// BUFFER SIZE
	ME_PTR = &ME_TEXT;
	GetModuleFileName(HINSTANCE, &ME_TEXT, 256);

	ENVIRONMENT_BLOCK = GetEnvironmentStrings();
		ENDM
    }
    else version (fgh_win32 && !fgh_win32dll)
    {

INITCODE0	MACRO

		PUSHM	-1,0
		PUSH	&XCNOTIFY
		ASSUME	FS:NOTHING

		PUSH	DWORD PTR FS:[0]
	FS:[0] = ESP;

		PUSH	&ABORT

		ENDM

INITCODE1	MACRO

		LOCAL	OK1,OK2

	// nt chicago initialization

	memset(&BEGIN_BSS, 0, &FINISH_BSS+4 - &BEGIN_BSS);

	// HIGH BIT 0 MEANS NT, HIGH TWO BITS ON
	// MEANS CHICAGO...
	GetVersion();

	if ((EAX & 0xC0000000) == 0xC0000000)
	{
	    HOST_THREADED = -1;		// host is threaded
	}

	GetModuleFileName(0, &ME_TEXT, 256);

	// GET PTR TO ASCII COMMAND LINE
	INPTR1 = GetCommandLine();

	// SKIP MY FILENAME
	YY_FILENAME();

	EDI = INPTR1;
	*EDI++ = 0;

	CMDLINE_PTR = EDI;
	CMDLINE_LENGTH = strlen(EDI);

	ENVIRONMENT_BLOCK = GetEnvironmentStrings();

	SetHandleCount(255);	// THIS SHOULD WORK
	SetHandleCount(2048);	// THIS MIGHT...

	STDOUT = GetStdHandle(STD_OUTPUT_HANDLE);
		ENDM
    }
    else
    {
	static assert("unknown host os");
    }

INITLISTS	MACRO	A,B,C,D,E,F,G,H,I,J,K,L,M,N,O,P,Q,R,S
		LOCAL	L1

		IRP	XX,<A,B,C,D,E,F,G,H,I,J,K,L,M,N,O,P,Q,R,S>
		IFB	<XX>
		EXITM
		ELSE
	EAX = OFF XX&_LIST;
	INIT_LISTS();
		ENDIF
		ENDM

	goto L1;

INIT_LISTS()
{
	FILE_LISTS* ESI = EAX;
	EAX = FILE_LIST_STRUCT.FILE_LIST_NFN;
	// EAX ADDRESS
	TEXT_POOL_ALLOC
	EDI = EAX;
	INSTALL_POINTER_GINDEX	FILE_LIST_GARRAY

	[ESI].FILE_LAST_GINDEX = EAX;
	[ESI].FILE_FIRST_GINDEX = EAX;
	memset(EDI, 0, FILE_LIST_STRUCT.FILE_LIST_NFN);
}

		ASSUME	ESI:NOTHING

L1:
		ENDM


INITSYMHASH	MACRO

	// THIS TABLE USE TO HASH SYMBOLS.
	GET_NEW_LOG_BLK();

	SYM_HASH_LOG = EAX;
	SYM_HASH_PHYS = EAX;

	ECX = SYM_HASH;
		PUSH	EDI

	EDI = EAX;
	EAX = 0;

	// ZERO OUT HASH TABLE
		OPTI_STOSD
		POP	EDI
		ENDM


INITMULTIHASH	MACRO

	// THIS TABLE USE TO HASH CLASSES, SEGMENTS, GROUPS, ETC
	GET_NEW_LOG_BLK();
		PUSH	EDI
	MULTI_HASH_LOG = EAX;
	SEGMENT_HASH_TABLE_PTR += EAX;
	GROUP_HASH_TABLE_PTR += EAX;
	CLASS_HASH_TABLE_PTR += EAX;
	MODULE_HASH_TABLE_PTR += EAX;
	LOCAL_HASH_TABLE_PTR += EAX;

	ECX = LOCAL_HASH_TABLE_PTR;
	LOCAL_HASH_TABLE_PTR_OLD = ECX;

	ECX = PAGE_SIZE/4;
	EDI = EAX;
	EAX = 0;
	// ZERO OUT HASH TABLE
		OPTI_STOSD
		POP	EDI

		ENDM


INITCODE2	MACRO


	// fgh_os2
    version(0)
    {
	// ROUTINE
		PUSHM	SEG ABORT_C,OFF ABORT_C
	// PREV_ADDRESS
		PUSHM	0,0
	// PREV_ACTION
		PUSHM	0,0
	// USE THIS ROUTINE
		PUSH	2
	// CTRL-C
		PUSH	1
	DOSSETSIGHANDLER();
	// ROUTINE
		PUSHM	SEG ABORT_C,OFF ABORT_C
	// PREV_ADDRESS
		PUSHM	0,0
	// PREV_ACTION
		PUSHM	0,0
	// USE THIS ROUTINE
		PUSH	2
	// CTRL-BREAK
		PUSH	4
	DOSSETSIGHANDLER();
elseif fgh_dosx

	// SAVE CTL-C FLAG


	// GET & SAVE OLD CTRL-C FLAG
	AX = 3300H;
		INT21
	CTRL_C_FLAG = DL;
	AX = 3301H;
	// TURN ON ^C CHECKING...
	DL = 1;
		INT21

	// 		MOV	EDX,OFF ABORT_C

	// 		MOV	AX,2523H		;SET ^C VECTOR

	// 		INT21


    }

		ENDM
.LIST

